import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/Login'
import LoginPage from '../pages/LoginPage'
import Register from '../components/Register'
import Home from '../pages/Home'
import ArticleDetail from '../components/pages/ArticleDetail.vue'
import Contents from '../components/Content.vue'

//1. 注入插件
Vue.use(VueRouter)
//2. 定义路由
const routes = [
    {
        path: '/',
        redirect: '/index'
    },
    {
        path:'/',
        component: Home,
        children: [
            {
                path: 'index',
                component: Contents,
                meta:{
                    title: '行思论坛'
                }
            },
            {
                path: 'dqarticle/:articleid',
                component: ArticleDetail
            },
        ]
    },
    {
        path: '/loginpage',
        component: LoginPage,
        children: [
            {
                path: 'login',
                component: Login,
                meta:{
                    title: '登陆'
                }
            },
            {
                path: 'register',
                component: Register,
                meta:{
                    title: '注册'
                }
            }
        ]
    }
]
//3. 创建router实例
const router = new VueRouter({
    routes,
    // mode: 'history'
})
//4.导出router实例
export default router